<template>
  <div>
    <div class="banner" @click="bannerClick">
      <img class="banner_img " :src="bannerImg"/>
      <div class="banner_info">
        <div class="banner_title">
          {{this.sightName}}
        </div>
        <div class="banner_number">
          <span class="iconfont banner_icon">&#xe692;</span>
          {{this.bannerImgs.length}}
        </div>
      </div>
    </div>
    <fade-animation><!--detail-gallery相当于slot插槽-->
      <detail-gallery
        :imgs="bannerImgs"
        v-show="showGrallery"
        @close="galleryClose"
      ></detail-gallery>
    </fade-animation>
  </div>
</template>

<script>
import DetailGallery from 'common/gallery/Gallery'
import FadeAnimation from 'common/fade/FadeAnimation'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    bannerImgs: Array
  },
  data () {
    return {
      showGrallery: false
    }
  },
  methods: {
    bannerClick () {
      this.showGrallery = true
    },
    galleryClose () {
      this.showGrallery = false
    }
  },
  components: {
    DetailGallery,
    FadeAnimation
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    overflow: hidden
    height: 0
    padding-bottom: 55%
    position: relative
    .banner_img
      width: 100%
    .banner_info
      position: absolute
      left: 0
      right: 0
      bottom: 0
      line-height: .6rem
      display: flex
      color: #fff
      background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
      .banner_title
        flex: 1
        font-size: .32rem
        padding: 0 .2rem
      .banner_number
        height: .32rem
        line-height: .32rem
        padding: 0 .4rem
        margin-top: .12rem
        font-size: .24rem
        border-radius: .2rem
        background: rgba(0, 0, 0, .5)
        .banner_icon
          font-size: .24rem

</style>
